package com.kakarote.crm9.erp.admin.common;

import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import com.jfinal.log.Log;
import org.slf4j.MDC;


public class AdminInterceptor implements Interceptor {
    @Override
    public void intercept(Invocation invocation) {
        if(StrUtil.isBlank(MDC.get("uuid"))){
            MDC.put("uuid", IdUtil.simpleUUID());
        }
        Log.getLog(getClass()).info(String.format("%s -%s",invocation.getControllerKey(),invocation.getMethodName()));
        invocation.invoke();
    }
}
